<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="949.46">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; min-height: 14.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #9e1517}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #406f0b}
span.s1 {color: #000000}
span.s2 {color: #001abc}
span.s3 {color: #9e1517}
span.s4 {color: #406f0b}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1"><b>PV_SpectralMap<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>maps the spectral envelope of one FFT</b></p>
<p class="p1"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>process onto another (acts as a spectral</b></p>
<p class="p1"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>filter)</b></p>
<p class="p2"><br></p>
<p class="p3"><b>WARNING: Use of a FFTs with a large window size may cause CPU spikes.</b></p>
<p class="p2"><br></p>
<p class="p3"><b>PV_SpectralMap(buffer, specBuffer, floor, freeze, reject)</b></p>
<p class="p2"><br></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>buffer - the FFT buffer to filter</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>specBuffer - the FFT buffer to derive the spectral curve from</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>floor - the spectral curve is a normalized representation of the magnitudes in specBuffer (between 0<span class="Apple-converted-space"> </span></b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>and 1). if floor &gt; 0, mags in the spectral curve BELOW this number are also zeroed out.</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>freeze - if &gt; 0, freeze the current spectral curve. The 'floor' parameter is ignored once the spectral</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>curve is frozen.</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>mode - if mode == 0, PV_SpectralMap does not have any effect. &gt; 0 acts as a bandpass filter, &lt; 0<span class="Apple-converted-space"> </span></b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>a bandreject.</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>norm - normalization mode. If &lt;=0, the specBuffer's magnitudes are normalized on a frame by</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>fram basis. &gt;0, normalized according to the the sum of the FFT window's sample values.</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>window - the window used for the FFT - this will effect scaling if norm is &gt; 0.</b></p>
<p class="p2"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-converted-space"> </span></b></p>
<p class="p3"><b>Examples:</b></p>
<p class="p4"><br></p>
<p class="p4"><br></p>
<p class="p5">s.boot;</p>
<p class="p6"><span class="s1">z = </span><span class="s2">Buffer</span><span class="s1">.read(s, </span>"sounds/a11wlk01.wav"<span class="s1">);</span></p>
<p class="p7"><br></p>
<p class="p8">(</p>
<p class="p8">x = <span class="s2">SynthDef</span>(<span class="s3">\specMap</span>, {<span class="s2">arg</span> sndBuf, freeze = <span class="s2">0</span>;</p>
<p class="p8"><span class="Apple-tab-span">	</span><span class="s2">var</span> a, b, chain1, chain2, out;</p>
<p class="p8"><span class="Apple-tab-span">	</span>a = <span class="s2">LocalBuf</span>.new(<span class="s2">2048</span>);</p>
<p class="p8"><span class="Apple-tab-span">	</span>b = <span class="s2">LocalBuf</span>.new(<span class="s2">2048</span>);</p>
<p class="p8"><span class="Apple-tab-span">	</span>chain1 = <span class="s2">FFT</span>(a, <span class="s2">LFSaw</span>.ar(120)); <span class="s4">// to be filtered</span></p>
<p class="p8"><span class="Apple-tab-span">	</span>chain2 = <span class="s2">FFT</span>(b, <span class="s2">PlayBuf</span>.ar(<span class="s2">1</span>, z, <span class="s2">1</span>, loop: <span class="s2">1</span>));</p>
<p class="p9"><span class="s1"><span class="Apple-tab-span">	</span></span>// mouse x to play with floor.<span class="Apple-converted-space"> </span></p>
<p class="p8"><span class="Apple-tab-span">	</span>chain1 = <span class="s2">PV_SpectralMap</span>(chain1, chain2, <span class="s2">0.0</span>, freeze, MouseX.kr(-1, 1), 1);</p>
<p class="p8"><span class="Apple-tab-span">	</span>out = <span class="s2">IFFT</span>(chain1);</p>
<p class="p8"><span class="Apple-tab-span">	</span><span class="s2">Out</span>.ar(<span class="s2">0</span>, out.dup);</p>
<p class="p8">}).play(s, [<span class="s3">\sndBuf</span>, z, <span class="s3">\freeze</span>, <span class="s2">0</span>])</p>
<p class="p8">)</p>
<p class="p7"><br></p>
<p class="p8">x.set(\freeze, 1)</p>
<p class="p8">x.set(\freeze, 0);</p>
<p class="p7"><br></p>
<p class="p8">x.free;</p>
<p class="p7"><br></p>
<p class="p8">z.free;</p>
</body>
</html>
